<template>
  <div class="issue-list">
    <div v-for="issue in issues" :key="issue.id" class="issue-item">
      <div class="issue-header">
        <span class="status" :class="statusClass(issue.status)">
          {{ issue.status }}
        </span>
        <span class="timestamp">{{ formatDate(issue.timestamp) }}</span>
      </div>
      <p class="description">{{ issue.description }}</p>
      <div v-if="issue.images.length" class="image-grid">
        <img
          v-for="(img, index) in issue.images"
          :key="index"
          :src="img"
          class="preview-image"
        />
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    issues: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    formatDate(isoString) {
      return new Date(isoString).toLocaleString()
    },
    statusClass(status) {
      return {
        resolved: status === '已解决',
        pending: status === '待处理'
      }
    }
  }
}
</script>

<style scoped>
.issue-item {
  padding: 12px;
  margin: 10px 0;
  border: 1px solid #eee;
  border-radius: 6px;
}

.status {
  font-size: 0.9em;
  padding: 2px 8px;
  border-radius: 4px;
}

.resolved {
  background: #d4edda;
  color: #155724;
}

.pending {
  background: #fff3cd;
  color: #856404;
}

.image-grid {
  /* 复用RecordList的样式 */
}
</style>
